import { maccApi, requestHttp } from '@utils/index';
// import { i18nRender } from '@/locales';
const state = {
  serverGrpConf: [],
};

const mutations = {
  SET_SERVER_GRP_CONF(state, payload) {
    state.serverGrpConf = payload;
  },

  CLEAR_DOT1X_STATE(state) {
    state.serverGrpConf = null;
  },
};

const actions = {
  async getServerGrp({ commit }, groupId) {
    let { code, data, msg } = await requestHttp({
      api: maccApi.DOT1X_SERVER_CONFIG_GET_API,
      method: 'GET',
      replaces: {
        group_id: groupId,
      },
    });
    let serverGrpConf = null;
    if (code == 0) {
      serverGrpConf = data;
    }

    commit('SET_SERVER_GRP_CONF', serverGrpConf);
    return { code, msg };
  },
};

const getters = {};

export default {
  namespaced: true, //开启命名空间，更好的区分使用stage,防止不同stage模块中的方法重名
  state,
  getters,
  mutations,
  actions,
};
